import react from 'react'
 

import Hook5 from './Hook5'

class App extends react.Component {
    constructor(props){
        super(props)
        this.state = {
            num:1
        }
    }

    add = ()=>{
        this.setState({
            num:this.state.num +1
        })
    }

    render() {
        return (
            <div>
                <h1>{this.state.num}</h1>
                <button onClick={this.add}>点击+</button>
                {
                    this.state.num >10 ? <h1>全新页面</h1>:<Hook5></Hook5>
                }
            </div>
        )
    }

}



export default App